package com.wuze.cloud.enums;


import lombok.Getter;


/**
 * @author: wuze
 * @description:
 * @date: 2023/02/19
 */
public enum SysUserRoleEnum {

    ROOT(0, "管理员"),

    SIMPLE(1, "普通用户");

    @Getter
    private Integer code;

    @Getter
    private String name;

    SysUserRoleEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String RoleOfCode(Integer code) {
        for (SysUserRoleEnum userRoleEnum : values()) {
            if (userRoleEnum.code.equals(code)) {
                return userRoleEnum.name();
            }
        }
        return null;
    }

    public static Integer CodeOfRole(String role) {
        for (SysUserRoleEnum userRoleEnum : values()) {
            if (userRoleEnum.name().equals(role)) {
                return userRoleEnum.code;
            }
        }
        return null;
    }


}
